<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="工单状态" prop="orderStatus">
        <el-select v-model="queryParams.orderStatus" placeholder="请选择工单状态" clearable style="width: 150px;">
          <el-option
            v-for="dict in order_status"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="Plus"
          @click="handleAdd"
          v-hasPermi="['mes:order:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="Edit"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['mes:order:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="Delete"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['mes:order:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="Download"
          @click="handleExport"
          v-hasPermi="['mes:order:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="orderList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column v-if="false" label="主键ID" align="center" prop="orderId" />
      <el-table-column label="货运司机" align="center" prop="driver">
        <template #default="scope">
          <dict-tag :options="driverList" :value="scope.row.driver"/>
        </template>
      </el-table-column>
      <el-table-column label="货运方式" align="center" prop="transportType">
        <template #default="scope">
          <dict-tag :options="transport_type" :value="scope.row.transportType"/>
        </template>
      </el-table-column>
      <el-table-column label="实际用车" align="center" prop="factLicensePlate">
        <template #default="scope">
          <dict-tag :options="car_list" :value="scope.row.factLicensePlate"/>
        </template>
      </el-table-column>      <el-table-column label="工单状态" align="center" prop="orderStatus">
        <template #default="scope">
          <dict-tag :options="order_status" :value="scope.row.orderStatus"/>
        </template>
      </el-table-column>
      <el-table-column label="更新时间" align="center" prop="updateTime" width="200"/>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template #default="scope">
          <el-button link type="primary" icon="Edit" @click="handleDetail(scope.row)" v-hasPermi="['mes:order:edit']">详情</el-button>
          <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['mes:order:edit']">修改</el-button>
          <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['mes:order:remove']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <pagination
      v-show="total>0"
      :total="total"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改工单管理对话框 -->
    <el-dialog :title="title" v-model="open" width="1000px" append-to-body>
      <el-form ref="orderRef" :model="form" :rules="rules" label-width="80px">
        <el-row :gutter="20"> 
          <el-col :span="12"> 
            <el-form-item label="项目名称" prop="projectId">
              <el-select v-model="form.projectId" placeholder="请选择项目" style="width: 300px;" :disabled = "form.orderId" clearable>
                <el-option
                    v-for="dict in project_list"
                    :key="dict.value"
                    :label="dict.label"
                    :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12"> 
            <el-form-item label="客户名称" prop="companyId">
              <el-select v-model="form.companyId" placeholder="请选择客户" style="width: 300px;" :disabled = "form.orderId">
                <el-option
                  v-for="dict in company_id"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12"> 
            <el-form-item label="货运司机" prop="driver">
              <el-select v-model="form.driver" placeholder="请输入货运司机"  style="width: 300px;" :disabled = "form.orderId">
                <el-option
                  v-for="dict in driverList"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12"> 
            <el-form-item label="货运方式" prop="transportType">
              <el-select v-model="form.transportType" placeholder="请选择货运方式" style="width: 300px;" @change="handleTransportTypeChange(form.transportType)">
                <el-option
                  v-for="dict in transport_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12"> 
            <el-form-item v-if="form.transportType == 1" label="预定用车" prop="bookLicensePlate">
              <el-select v-model="form.bookLicensePlate" placeholder="请选择预定用车"  style="width: 300px;">
                <el-option
                  v-for="dict in car_list_select"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-divider content-position="center">辅料工单信息</el-divider>
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" icon="Plus" @click="handleAddStoreOrderAuxiliary">添加</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="danger" icon="Delete" @click="handleDeleteStoreOrderAuxiliary">删除</el-button>
          </el-col>
        </el-row>
        <el-table :data="storeOrderAuxiliaryList" :row-class-name="rowStoreOrderAuxiliaryIndex" @selection-change="handleStoreOrderAuxiliarySelectionChange" ref="storeOrderAuxiliary">
          <el-table-column type="selection" width="50" align="center" />
          <el-table-column v-if ='false' label="序号" align="center" prop="index" width="50"/>
          <el-table-column label="类别" align="center" prop="auxiliaryType" width="120">
            <template #default="scope">
              <el-select v-model="scope.row.auxiliaryType" placeholder="请输入类别" clearable>
                <el-option
                  v-for="dict in auxiliary_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                />
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="辅料名称" align="center" prop="name" width="220">
            <template #default="scope">
              <el-input v-model="scope.row.name" placeholder="请输入辅料名称" />
            </template>
          </el-table-column>
          <el-table-column label="型号" align="center" prop="model" width="150">
            <template #default="scope">
              <el-input v-model="scope.row.model" placeholder="请输入型号" />
            </template>
          </el-table-column>
          <el-table-column label="规格" align="center" prop="specifications" width="120">
            <template #default="scope">
              <el-input v-model="scope.row.specifications" placeholder="请输入规格" />
            </template>
          </el-table-column>
          <el-table-column label="单位" align="center" prop="unit" width="120">
            <template #default="scope">
              <el-input v-model="scope.row.unit" placeholder="请输入单位" />
            </template>
          </el-table-column>
          <el-table-column label="数量" align="center" prop="num" width="180">
            <template #default="scope">
              <el-input-number v-model="scope.row.num" placeholder="请输入数量" min="1"/>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>

    <!-- 详情 -->
    <el-dialog :title="title" v-model="detail" width="1000px" append-to-body>
      <el-form ref="orderRef" :model="form" :rules="rules" label-width="120px">
        <el-row :gutter="20">
          <el-col :span="12"  v-if="form.projectId">
            <el-form-item label="项目名称" prop="projectId">
              <el-select v-model="form.projectId" placeholder="请选择项目" style="width: 300px;" disabled>
                <el-option
                  v-for="dict in project_list"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>            
          </el-col>
          <el-col :span="12">
            <el-form-item label="负责人" prop="responsiblePerson">
              <el-input v-model="form.responsiblePerson" placeholder="请输入"  style="width: 300px;" disabled/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="客户名称" prop="companyName">
              <el-input v-model="form.companyName" placeholder="请输入"  style="width: 300px;" disabled/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联系人" prop="companyPerson">
              <el-input v-model="form.companyPerson" placeholder="请输入"  style="width: 300px;" disabled/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联系人电话" prop="companyPhone">
              <el-input v-model="form.companyPhone" placeholder="请输入"  style="width: 300px;" disabled/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="取货司机" prop="driver">
              <el-select v-model="form.driver" placeholder="请输入" style="width: 300px;" disabled>
                <el-option
                  v-for="dict in driverList"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>            
          </el-col>
          <el-col :span="12">
            <el-form-item label="货运方式" prop="transportType">
              <el-select v-model="form.transportType" placeholder="请选择货运方式"  style="width: 300px;" disabled>
                <el-option
                  v-for="dict in transport_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="form.bookLicensePlate">
            <el-form-item label="预定用车" prop="bookLicensePlate">
              <el-select v-model="form.bookLicensePlate" placeholder="请选择预定用车"  style="width: 300px;" disabled>
                <el-option
                  v-for="dict in car_list"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="form.factLicensePlate">
            <el-form-item label="实际用车" prop="factLicensePlate">
              <el-select v-model="form.factLicensePlate" placeholder="请选择实际用车"  style="width: 300px;" disabled>
                <el-option
                  v-for="dict in car_list"
                  :key="dict.value"
                  :label="dict.label"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="form.takeCarDistance">
            <el-form-item label="取车公里数" prop="takeCarDistance">
              <el-input v-model="form.takeCarDistance" placeholder="请输入"  style="width: 300px;" type="number" disabled/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="工单类型" prop="orderType">
              <el-select v-model="form.orderType" placeholder="请选择工单类型"  style="width: 300px;" disabled>
                <el-option
                  v-for="dict in selected.order_type"
                  :key="dict.value"
                  :label="dict.label"
                  :value="parseInt(dict.value)"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="form.takeCarTime">
            <el-form-item label="取车时间" prop="takeCarTime">
              <el-date-picker clearable  style="width: 300px;" disabled
                v-model="form.takeCarTime"
                type="datetime"
                value-format="YYYY-MM-DD HH:mm:ss"
                placeholder="请选择取车时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="form.departTime">
            <el-form-item label="出发时间" prop="departTime">
              <el-date-picker clearable   style="width: 300px;" disabled
                v-model="form.departTime"
                type="datetime"
                value-format="YYYY-MM-DD HH:mm:ss"
                placeholder="请选择出发时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="form.arriveTime">
            <el-form-item label="到达时间" prop="arriveTime">
              <el-date-picker clearable   style="width: 300px;" disabled
                v-model="form.arriveTime"
                type="datetime"
                value-format="YYYY-MM-DD HH:mm:ss"
                placeholder="请选择到达时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="form.backTime">
            <el-form-item label="返程时间" prop="backTime">
              <el-date-picker clearable   style="width: 300px;" disabled
                v-model="form.backTime"
                type="datetime"
                value-format="YYYY-MM-DD HH:mm:ss"
                placeholder="请选择返程时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="form.backStoreTime">
            <el-form-item label="到厂时间" prop="backStoreTime">
              <el-date-picker clearable   style="width: 300px;" disabled
                v-model="form.backStoreTime"
                type="datetime"
                value-format="YYYY-MM-DD HH:mm:ss"
                placeholder="请选择到厂时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="form.inputStoreTime">
            <el-form-item label="入库时间" prop="inputStoreTime">
              <el-date-picker clearable   style="width: 300px;" disabled
                v-model="form.inputStoreTime"
                type="datetime"
                value-format="YYYY-MM-DD HH:mm:ss"
                placeholder="请选择入库时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="form.returnCarDistance">
            <el-form-item label="还车公里数" prop="returnCarDistance">
              <el-input v-model="form.returnCarDistance" placeholder="请输入"  style="width: 300px;" type="number" :disabled="form.orderStatus != 7" />
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="form.returnCarTime">
            <el-form-item label="还车时间" prop="returnCarTime">
              <el-date-picker clearable   style="width: 300px;" disabled
                v-model="form.returnCarTime"
                type="datetime"
                value-format="YYYY-MM-DD HH:mm:ss"
                placeholder="请选择还车时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>
        <el-divider content-position="center">单据图片</el-divider>
        <el-form-item label="图片" prop="imageOrder" disabled>
          <image-upload v-model="form.imageOrder"/>
        </el-form-item>
        <el-divider content-position="center">货物图片</el-divider>
        <el-form-item label="图片" prop="imageCargo" disabled>
          <image-upload v-model="form.imageCargo"/>
        </el-form-item>
        <div v-if="form.transportType == 1">
          <el-divider content-position="center">车辆图片</el-divider>
          <el-form-item label="图片" prop="imageCar" disabled>
            <image-upload v-model="form.imageCar"/>
          </el-form-item>
        </div>
        <el-divider content-position="center">工单货物信息</el-divider>
          <el-table :data="storeOrderAuxiliaryList" ref="storeOrderAuxiliary">
            <el-table-column label="类别" align="center" prop="unit" width="120">
              <template #default="scope">
                <el-select v-model="scope.row.auxiliaryType" placeholder="请输入类别" clearable disabled>
                  <el-option
                    v-for="dict in auxiliary_type"
                    :key="dict.value"
                    :label="dict.label"
                    :value="dict.value"
                  />
                </el-select>
              </template>
            </el-table-column>
            <el-table-column label="辅料名称" align="center" prop="name" width="250">
              <template #default="scope">
                <el-input v-model="scope.row.name" placeholder="请输入辅料名称" disabled/>
              </template>
            </el-table-column>
            <el-table-column label="型号" align="center" prop="model" width="150">
              <template #default="scope">
                <el-input v-model="scope.row.model" placeholder="请输入型号" disabled/>
              </template>
            </el-table-column>
            <el-table-column label="规格" align="center" prop="specifications" width="120">
              <template #default="scope">
                <el-input v-model="scope.row.specifications" placeholder="请输入规格" disabled/>
              </template>
            </el-table-column>
            <el-table-column label="单位" align="center" prop="unit" width="120">
            <template #default="scope">
              <el-input v-model="scope.row.unit" placeholder="请输入单位" disabled/>
            </template>
          </el-table-column>
            <el-table-column label="数量" align="center" prop="num" width="180">
              <template #default="scope">
                <el-input-number v-model="scope.row.num" placeholder="请输入数量" min="1" disabled/>
              </template>
            </el-table-column>
          </el-table>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="cancel">关 闭</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="Order">
import { listOrder, getOrder, getOrderDetail, delOrder, addOrder, updateOrder } from "@/api/mes/order";
import { getProjectAll } from "@/api/mes/project";
import { listCar } from "@/api/mes/car";
import { ElMessage } from 'element-plus'

const { proxy } = getCurrentInstance();
const { order_status, transport_type, auxiliary_type } = proxy.useDict( 'order_status', 'transport_type', 'auxiliary_type');
const { driverList } = proxy.mesDriverList("driverList");
const { company_id } = proxy.mesCompany("company_id");


const orderList = ref([]);
const storeOrderAuxiliaryList = ref([]);
const open = ref(false);
const detail = ref(false);

const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const checkedStoreOrderAuxiliary = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const project_list = ref([]);
const car_list_select = ref([]);
const car_list = ref([]);

const data = reactive({
  form: {},
  queryParams: {
    pageNum: 1,
    pageSize: 10,
    orderType: 3,
    orderStatus: null,
    orderWholeStatus: null,
  },
  rules: {
    transportType: [
      { required: true, message: "货运方式不能为空", trigger: "change" }
    ],
    driver: [
      { required: true, message: "货运司机不能为空", trigger: "change" }
    ],
    companyId: [
      { required: true, message: "客户名称不能为空", trigger: "change" }
    ],
  },
  selected: {
    order_type: [
      { value: '3', label: '辅料入库' },
      { value: '4', label: '辅料出库' }
    ]
  }
});

const { queryParams, form, rules, selected } = toRefs(data);

/** 查询工单管理列表 */
function getList() {
  loading.value = true;
  listOrder(queryParams.value).then(response => {
    orderList.value = response.rows;
    total.value = response.total;
    loading.value = false;
  });
}

// 取消按钮
function cancel() {
  open.value = false;
  detail.value = false;
  reset();
}

// 表单重置
function reset() {
  form.value = {
    orderId: null,
    orderBatch: null,
    projectId: null,
    contactPerson: null,
    driver: null,
    responsiblePerson: null,
    transportType: null,
    bookLicensePlate: null,
    orderType: null,
    storePerson: null,
    orderStatus: null,
    takeCarTime: null,
    takeCarDistance: null,
    factLicensePlate: null,
    departTime: null,
    arriveTime: null,
    backTime: null,
    backStoreTime: null,
    inputStoreTime: null,
    productCheck: null,
    productDesc: null,
    returnCarTime: null,
    returnCarStatus: null,
    returnCarDistance: null,
    remark: null,
    orderWholeStatus: null,
    status: null,
    createTime: null,
    updateTime: null,
    companyId: null
  };
  storeOrderAuxiliaryList.value = [];
  proxy.resetForm("orderRef");
}

/** 查询项目管理 */
function getProjectList() {
  getProjectAll().then(response => {
    project_list.value = response.rows.map(project => ({
          value: project.projectId.toString(),
          label: project.projectName
        }));
  });
}
/** 货运方式触发事件 */
function handleTransportTypeChange(obj) {
  if(obj == '1'){
    listCar({carStatus:'0'}).then(response => {
    car_list_select.value = response.data.map(car => ({
          value: car.carId.toString(),
          label: car.carNo
     }));
  })
}
}

/** 查询车辆列表 */
function getCarList() {
  listCar().then(response => {
    car_list.value = response.data.map(car => ({
          value: car.carId.toString(),
          label: car.carNo
        }));
  });
}

/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNum = 1;
  getList();
}

/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm("queryRef");
  handleQuery();
}

// 多选框选中数据
function handleSelectionChange(selection) {
  ids.value = selection.map(item => item.orderId);
  single.value = selection.length != 1;
  multiple.value = !selection.length;
}

/** 新增按钮操作 */
function handleAdd() {
  reset();
  open.value = true;
  title.value = "添加工单管理";
}

/** 修改按钮操作 */
function handleUpdate(row) {
  car_list_select.value = car_list.value;
  reset();
  const _orderId = row.orderId || ids.value
  getOrder(_orderId).then(response => {
    form.value = response.data;
    storeOrderAuxiliaryList.value = response.data.storeOrderAuxiliaryList;
    open.value = true;
    title.value = "修改工单管理";
  });
}

function handleDetail(row) {
  reset();
  getOrderDetail({orderId:row.orderId,orderType: 3}).then(response => {
    form.value = response.data;
    console.log(response.data)
    storeOrderAuxiliaryList.value = response.data.storeOrderAuxiliaryList
    detail.value = true;
    title.value = "详情";
  });
}

/** 提交按钮 */
function submitForm() {
  if(storeOrderAuxiliaryList.value.length == 0){
    ElMessage.error('请添加辅料信息');
  }
  form.value.orderType = 3;
  proxy.$refs["orderRef"].validate(valid => {
    if (valid) {
      form.value.storeOrderAuxiliaryList = storeOrderAuxiliaryList.value;
      if (form.value.orderId != null) {
        updateOrder(form.value).then(response => {
          proxy.$modal.msgSuccess("修改成功");
          open.value = false;
          getList();
        });
      } else {
        addOrder(form.value).then(response => {
          proxy.$modal.msgSuccess("新增成功");
          open.value = false;
          getList();
        });
      }
    }
  });
}

/** 删除按钮操作 */
function handleDelete(row) {
  const _orderIds = row.orderId || ids.value;
  proxy.$modal.confirm('是否确认删除工单管理编号为"' + _orderIds + '"的数据项？').then(function() {
    return delOrder(_orderIds);
  }).then(() => {
    getList();
    proxy.$modal.msgSuccess("删除成功");
  }).catch(() => {});
}

/** 辅料工单表序号 */
function rowStoreOrderAuxiliaryIndex({ row, rowIndex }) {
  row.index = rowIndex + 1;
}

/** 辅料工单表添加按钮操作 */
function handleAddStoreOrderAuxiliary() {
  let obj = {};
  obj.auxiliaryType = "";
  obj.name = "";
  obj.model = "";
  obj.specifications = "";
  obj.num = "";
  obj.status = "";
  storeOrderAuxiliaryList.value.push(obj);
}

/** 辅料工单表删除按钮操作 */
function handleDeleteStoreOrderAuxiliary() {
  if (checkedStoreOrderAuxiliary.value.length == 0) {
    proxy.$modal.msgError("请先选择要删除的辅料工单表数据");
  } else {
    const storeOrderAuxiliarys = storeOrderAuxiliaryList.value;
    const checkedStoreOrderAuxiliarys = checkedStoreOrderAuxiliary.value;
    storeOrderAuxiliaryList.value = storeOrderAuxiliarys.filter(function(item) {
      return checkedStoreOrderAuxiliarys.indexOf(item.index) == -1
    });
  }
}

/** 复选框选中数据 */
function handleStoreOrderAuxiliarySelectionChange(selection) {
  checkedStoreOrderAuxiliary.value = selection.map(item => item.index)
}

/** 导出按钮操作 */
function handleExport() {
  proxy.download('mes/order/export', {
    ...queryParams.value
  }, `order_${new Date().getTime()}.xlsx`)
}

getList();
getProjectList();
getCarList();
</script>
